//
//  CustomerOtherCell.m
//  New_Runway
//
//  Created by mack on 2018/2/9.
//  Copyright © 2018年 NelsonJ. All rights reserved.
//

#import "CustomerOtherCell.h"

@interface CustomerOtherCell ()
@property(nonatomic,strong)MSSAutoresizeLabelFlow *autoFitL;
@property (nonatomic, assign)CGFloat totalH;

@end
@implementation CustomerOtherCell
+ (id)cellWithTableView:(UITableView *)tableView
{
    static NSString *identifier = @"CustomerOtherCell";
    CustomerOtherCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) {
        cell = [[CustomerOtherCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    }
    return cell;
}

- (void)setTagsFrame:(TagsFrame *)tagsFrame
{
    _tagsFrame = tagsFrame;
    UILabel *label= [[UILabel alloc] init];
    label.text = @"偏爱车辆标签";
    label.font = [UIFont systemFontOfSize:13];
    label.textColor = MAIN_FONT_COLOR();
    [self.contentView addSubview:label];
    label.frame = CGRectMake(0, 16, Screen_width, 40);
    
    
    // 解决cell重用时的bug
    [self.contentView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
    
    for (NSInteger i = 0; i < tagsFrame.tagsArray.count; i++) {
        UIButton *tagsBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [tagsBtn setTitle:tagsFrame.tagsArray[i] forState:UIControlStateNormal];
        [tagsBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        tagsBtn.titleLabel.font = TagsTitleFont;
        tagsBtn.backgroundColor = [UIColor whiteColor];
        tagsBtn.layer.borderWidth   = 1;
        tagsBtn.layer.borderColor   = [UIColor lightGrayColor].CGColor;
        tagsBtn.layer.cornerRadius  = 4;
        tagsBtn.layer.masksToBounds = YES;
        
        tagsBtn.frame = CGRectFromString(tagsFrame.tagsFrames[i]);
        
        [self.contentView addSubview:tagsBtn];
    }
}

@end
